﻿/******************************************************   
创建者: ljj
创建时间: 2018-03-12
修改:
修改时间: 
功能: 翻单量计算导出
 ******************************************************/

using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using com.nm.library.Excels;

namespace InventoryToPredictAPI.Export
{
    [Export(typeof(ExcelImport))]
    class GoodsReorderTotalDemandItem : ExcelImport
    {
        public override ExcelImportType Type => ExcelImportType.GOODSREORDERTOTALDEMAMDITEM;
        public override Dictionary<string, ImportVerify> DictFields => _dictFields;

        private static readonly Dictionary<string, ImportVerify> _dictFields = new List<ImportVerify> {
            new ImportVerify{ ColumnName="货号",FieldName="MaterialID",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="店类型",FieldName="ShopType",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="店铺级别",FieldName="InfoName",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="店铺数",FieldName="ShopNum",DataType=typeof(long?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="日均销",FieldName="DaySaleQty",DataType=typeof(double?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="月份",FieldName="month",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="本月销售天数",FieldName="MonthDays",DataType=typeof(long?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="预计销售",FieldName="MonthSaleQty",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
        }.ToDictionary(e => e.ColumnName, e => e);

        public override object SaveImportData(DataTable dt, Dictionary<string, object> extraInfo, int userId)
        {
            throw new NotImplementedException();
        }

        public override DataTable GetExportData(string Keys)
        {
            var handler = new GoodsReorderTotalDemandHandler();
            return handler.ExportGoodsReorderTotalDemandItem(Keys);
        }
    }
}
